package per.ace.configuration.demo.condition;

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @program: springbootDemo
 * @description: test @ConditionalOnClass 当加载某个class才执行
 * @author: ace
 * @Date: 2019-12-29 14:25
 **/
@Configuration
public class TestConditional {

    @Bean
    @ConditionalOnClass(name="org.springframework.data.redis.core.RedisTemplate")
    public void testConditionRedis(){
        System.out.println("代码中使用了spring-date-redis,conditionalOnClass被执行");
    }
}
